﻿using System.Collections.Generic;
using GameFramework.common;
using GameFramework.skill;
using UnityEngine;

namespace GameFramework.buff
{
    [CreateAssetMenu(fileName = "BuffConfigManager", menuName = "configs/BuffConfigManager")]
    public class BuffConfigManager:ScriptableObjectSingleton<BuffConfigManager>
    {
        private  Dictionary<int, BuffConfig> buffConfigs = new Dictionary<int, BuffConfig>();

        public  List<BuffConfig> configs = new List<BuffConfig>();
        
        public BuffConfig getConfig(int id)
        {
            if (buffConfigs.Count > 0)
            {
                return buffConfigs[id];
            }

            return null;
        }

        protected override void  init()
        {
            
            //TODO 代码生成，加入容器
            // configs.Add();
            if (buffConfigs.Count == 0 && configs.Count > 0)
            {
                foreach (BuffConfig config in configs)
                {
                    buffConfigs.Add(config.id,config);
                }
            }
        }
    }
}